﻿@model System.Collections.Generic.IEnumerable<Kooboo.CMS.Sites.ABTest.ABRuleSetting>
@{
    ViewBag.Title = "A/B rules".Localize();
    Layout = "~/Views/Shared/Site.cshtml";
    //if (Site.Current != null)
    //{
    //    Layout = "~/Views/Shared/Site.cshtml";
    //}
    //else
    //{
    //    Layout = "~/Areas/Sites/Views/Shared/Global.cshtml";
    //}
    var allRules = Kooboo.CMS.Common.Runtime.EngineContext.Current.ResolveAll<Kooboo.CMS.Sites.ABTest.IVisitRule>();
 
}
@section Panel{
    <ul class="panel">
        <li class="j_DropDown">
            <a href="@Url.Action("Create", ViewContext.RequestContext.AllRouteValues().Merge("return", ViewContext.HttpContext.Request.RawUrl))">
                @Html.IconImage("add")
                @("Create".Localize())
                @*@Html.IconImage("arrow small white-down")*@
            </a>
            @* <ul class="j_DropDownContent hide">
                @foreach (var item in allRules)
                {
                    <li><a href="@Url.Action("Create", ViewContext.RequestContext.AllRouteValues().Merge("RuleType", (string)(item.RuleType)).Merge("return", ViewContext.HttpContext.Request.RawUrl))">
                        @((string)(item.RuleType).Localize())</a></li>    
                }
            </ul>*@
        </li>
        <li>
            <a href="@Url.Action("Import", ViewContext.RequestContext.AllRouteValues().Merge("return", ViewContext.HttpContext.Request.RawUrl).Merge("title", "Import A/B rules".Localize()))">
                @Html.IconImage("import") @("Import".Localize())
            </a>
        </li>

        <li><a href="@Url.Action("Delete", ViewContext.RequestContext.AllRouteValues().Merge("return", ViewContext.HttpContext.Request.RawUrl))" data-show-on-check="Any" data-command-type="AjaxPost" data-confirm="@("Are you sure you want to delete these items?".Localize())">
            @Html.IconImage("delete") @("Delete".Localize())</a></li>

        <li class="j_DropDown" data-show-on-check="Any">
            <a>
                @("More...".Localize())
                @Html.IconImage("arrow small white-down")
            </a>
            <ul class="j_DropDownContent hide">
                <li>
                    <a href="@Url.Action("Export", ViewContext.RequestContext.AllRouteValues().Merge("return", ViewContext.HttpContext.Request.RawUrl))" data-show-on-check="Any" data-command-type="Download">
                        @("Export".Localize())
                    </a>
                </li>
                <li><a href="@Url.Action("Relations", ViewContext.RequestContext.AllRouteValues().Merge("return", ViewContext.HttpContext.Request.RawUrl).Merge("title", "Show A/B rule relations"))" data-show-on-check="Single" data-command-type="Redirect">@("Relations".Localize())</a></li>
            </ul>
        </li>

        @foreach (var group in Kooboo.CMS.Sites.Extension.UI.TopToolbar.ToolbarButtons.GetToolbarButtons(ViewContext.RequestContext))
        {
            @Html.Partial("_ToolbarGroupButtons", group)
        }
    </ul>
}

<div class="topbar clearfix">
    <h1 class="title">
        @ViewBag.Title</h1>
</div>
@Html.GridForModel2()